package com.android.hello;

import android.content.Context; 
import android.util.AttributeSet; 
import android.view.GestureDetector; 
import android.view.MotionEvent; 
import android.view.View; 

public class MyView extends View { 

    private GestureDetector mGestureDetector; 
    
    public MyView(Context context, AttributeSet attrs) { 
        super(context, attrs); 
        mGestureDetector = new GestureDetector(context, new MyGestureListener(context)); 
        setLongClickable(true); 
        this.setOnTouchListener(new OnTouchListener() { 
            public boolean onTouch(View v, MotionEvent event) { 

                return mGestureDetector.onTouchEvent(event); 

            } 
        }); 
    } 
} 

